libxc: osdep: convert xc_evtchn_bind_interdomain()
authorIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 3 Dec 2010 09:36:47 +0000 (09:36 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
tools/libxc/xc_evtchn.c
tools/libxc/xc_linux.c
tools/libxc/xc_minios.c
tools/libxc/xc_netbsd.c
tools/libxc/xc_solaris.c
tools/libxc/xenctrlosdep.h

index 047b5193318594e2d2085559c8512c84cfb43d76..25c665eaa47cb919c8d7d62d9a00d0efa00a121a 100644 (file)
@@ -94,6 +94,13 @@ xc_evtchn_bind_unbound_port(xc_evtchn *xce, int domid)
     return xce->ops->u.evtchn.bind_unbound_port(xce, xce->ops_handle, domid);
 }
 
+evtchn_port_or_error_t
+xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
+                           evtchn_port_t remote_port)
+{
+    return xce->ops->u.evtchn.bind_interdomain(xce, xce->ops_handle, domid, remote_port);
+}
+
 /*
  * Local variables:
  * mode: C
index 0ae64fa26c9929ff1effa39d4c779664ce404c71..231f3fb6a239a60084c19f88864b47c3b0ad4dc2 100644 (file)
@@ -386,16 +386,17 @@ linux_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
     return ioctl(fd, IOCTL_EVTCHN_BIND_UNBOUND_PORT, &bind);
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
-                           evtchn_port_t remote_port)
+static evtchn_port_or_error_t
+linux_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
+                              evtchn_port_t remote_port)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_interdomain bind;
 
     bind.remote_domain = domid;
     bind.remote_port = remote_port;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
+    return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
 }
 
 evtchn_port_or_error_t
@@ -441,6 +442,7 @@ static struct xc_osdep_ops linux_evtchn_ops = {
         .fd = &linux_evtchn_fd,
         .notify = &linux_evtchn_notify,
         .bind_unbound_port = &linux_evtchn_bind_unbound_port,
+        .bind_interdomain = &linux_evtchn_bind_interdomain,
     },
 };
 
index 0a04e4517b0ca05bbb4c4ac3f7fb09f29825ec59..631078a31d0d71588ac0270a9dbf13604faed8f8 100644 (file)
@@ -302,27 +302,28 @@ static evtchn_port_or_error_t minios_evtchn_bind_unbound_port(xc_evtchn *xce, xc
     return port;
 }
 
-evtchn_port_or_error_t xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
+static evtchn_port_or_error_t minios_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
     evtchn_port_t remote_port)
 {
+    int fd = (int)h;
     evtchn_port_t local_port;
     int ret, i;
 
     assert(get_current() == main_thread);
-    i = port_alloc(xce->fd);
+    i = port_alloc(fd);
     if (i == -1)
        return -1;
 
     printf("xc_evtchn_bind_interdomain(%d, %"PRId32")", domid, remote_port);
-    ret = evtchn_bind_interdomain(domid, remote_port, evtchn_handler, (void*)(intptr_t)xce->fd, &local_port);
+    ret = evtchn_bind_interdomain(domid, remote_port, evtchn_handler, (void*)(intptr_t)fd, &local_port);
     printf(" = %d\n", ret);
 
     if (ret < 0) {
        errno = -ret;
        return -1;
     }
-    files[xce->fd].evtchn.ports[i].bound = 1;
-    files[xce->fd].evtchn.ports[i].port = local_port;
+    files[fd].evtchn.ports[i].bound = 1;
+    files[fd].evtchn.ports[i].port = local_port;
     unmask_evtchn(local_port);
     return local_port;
 }
@@ -406,6 +407,7 @@ static struct xc_osdep_ops minios_evtchn_ops = {
         .fd = &minios_evtchn_fd,
         .notify = &minios_evtchn_notify,
         .bind_unbound_port = &minios_evtchn_bind_unbound_port,
+        .bind_interdomain = &minios_evtchn_bind_interdomain,
     },
 };
 
index 6bd72d970e39f3fc7a5436db753b5fa16e345f90..f14ad85d715dc3cef5fe059148a80c205a615409 100644 (file)
@@ -241,17 +241,18 @@ netbsd_evtchn_bind_unbound_port(xc_evtchn * xce, xc_osdep_handle h, int domid)
        return -1;
 }
 
-evtchn_port_or_error_t
-xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
-                           evtchn_port_t remote_port)
+static evtchn_port_or_error_t
+netbsd_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
+                               evtchn_port_t remote_port)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_interdomain bind;
     int ret;
 
     bind.remote_domain = domid;
     bind.remote_port = remote_port;
 
-    ret = ioctl(xce->fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
+    ret = ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
     if (ret == 0)
        return bind.port;
     else
@@ -306,6 +307,7 @@ static struct xc_osdep_ops netbsd_evtchn_ops = {
          .fd = &netbsd_evtchn_fd,
          .notify = &netbsd_evtchn_notify,
          .bind_unbound_port = &netbsd_evtchn_bind_unbound_port,
+         .bind_interdomain = &netbsd_evtchn_bind_interdomain,
     },
 };
 
index eaacad5f70a303061d22a5a6c180f9f59ec91358..3e704c2c7eca25f4a8f5041c6be89b5963cbbeea 100644 (file)
@@ -229,15 +229,16 @@ solaris_evtchn_bind_unbound_port(xc_evtchn *xce, xc_osdep_handle h, int domid)
 }
 
 evtchn_port_or_error_t
-xc_evtchn_bind_interdomain(xc_evtchn *xce, int domid,
+solaris_evtchn_bind_interdomain(xc_evtchn *xce, xc_osdep_handle h, int domid,
                            evtchn_port_t remote_port)
 {
+    int fd = (int)h;
     struct ioctl_evtchn_bind_interdomain bind;
 
     bind.remote_domain = domid;
     bind.remote_port = remote_port;
 
-    return ioctl(xce->fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
+    return ioctl(fd, IOCTL_EVTCHN_BIND_INTERDOMAIN, &bind);
 }
 
 evtchn_port_or_error_t
@@ -283,6 +284,7 @@ static struct xc_osdep_ops solaris_evtchn_ops = {
         .fd = &solaris_evtchn_fd,
         .notify = &solaris_evtchn_notify,
         .bind_unbound_port = &solaris_evtchn_bind_unbound_port,
+        .bind_interdomain = &solaris_evtchn_bind_interdomain,
     },
 };
 
index d67d6d40c67ef28a388aa866f2a70d771a3eb6d6..83c79fdceb618fdd5713859ced6de80537dbf48c 100644 (file)
@@ -80,6 +80,8 @@ struct xc_osdep_ops
             int (*notify)(xc_evtchn *xce, xc_osdep_handle h, evtchn_port_t port);
 
             evtchn_port_or_error_t (*bind_unbound_port)(xc_evtchn *xce, xc_osdep_handle h, int domid);
+            evtchn_port_or_error_t (*bind_interdomain)(xc_evtchn *xce, xc_osdep_handle h, int domid,
+                                                       evtchn_port_t remote_port);
         } evtchn;
     } u;
 };